import 'package:freezed_annotation/freezed_annotation.dart';
import 'dart:convert';

part 'get_goods_list_response.freezed.dart';
part 'get_goods_list_response.g.dart';

@freezed
class GetGoodsListResponse with _$GetGoodsListResponse {
  const factory GetGoodsListResponse({
    @JsonKey(name: "code") required int code,
    @JsonKey(name: "msg") required String msg,
    @JsonKey(name: "time") required int time,
    @JsonKey(name: "data") required Data data,
  }) = _GetGoodsListResponse;

  factory GetGoodsListResponse.fromJson(Map<String, dynamic> json) =>
      _$GetGoodsListResponseFromJson(json);
}

@freezed
class Data with _$Data {
  const factory Data({
    @JsonKey(name: "total") required int total,
    @JsonKey(name: "per_page") required int perPage,
    @JsonKey(name: "current_page") required int currentPage,
    @JsonKey(name: "last_page") required int lastPage,
    @JsonKey(name: "data") required List<dynamic> data,
  }) = _Data;

  factory Data.fromJson(Map<String, dynamic> json) => _$DataFromJson(json);
}
